package com.hm.hsw6;

import java.util.HashMap;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        HashMap<Character, Integer> map = new HashMap<>();
        System.out.println("请输入信息");
        String s = sc.next();
        char[] chars = s.toCharArray();
        for (char aChar : chars) {
            //包含计数加1,更新计数
            if(map.containsKey(aChar)){
                map.put(aChar,map.get(aChar)+1);
            }else{
                map.put(aChar,1);
            }
        }
        map.forEach((k,v)-> System.out.print(k+"("+v+")"));
    }
}
